package controller;

/**
 * 
 * Action객체를 생성하는 Factory객체
 * Singleton Pattern 적용 
 * @author INSOO
 *
 */
public class ActionFactory{
	private static ActionFactory factory = new ActionFactory();

	private ActionFactory() {}
	
	public static ActionFactory getInstance() {
		return factory;
	}
	
	public Action getAction(String command) {
		Action action = null;
		if("login.do".equals(command)) {
			action = new LoginAction();
		} else if("signup.do".equals(command)) {
			action = new SignupAction();
		} else if("write.do".equals(command)) {
			action = new WriteAction();
		} else if("list.do".equals(command)) {
			action = new ListAction();
		} else if("read.do".equals(command)) {
			action = new ReadAction();
		}
		return action;
	}
}
